/**
 * 
 */
package niuke;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class Kolakoski {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int[] a = new int[m];
		for (int i = 0; i < m; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		int count = 0;
		int val = 0;
		int index = 0;
		int b[] = new int[n];
		int j = 0;
		for (int i = 0; i < n; i++) {
			if (count == 0) {// count>0，值不变
				val = a[index++];
				if (index == m) {
					index = 0;
				}
				if (j==i) {// 不能从b数组取，则从a取
					count = val;
				} else {
					count = b[j];
				}
				j++;
			}
			System.out.println(val);
			b[i] = val;
			count--;
		}
	}

}
